package org.tech4j.common.core.sign.api;

import org.tech4j.common.utils.SignUtils;

import java.net.URI;

/**
 * @program: tech4j-common
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/2 19:31
 **/
public class SignParameters {
    public static final SignParameters ERROR_PARAMETERS = new SignParameters();

    private final String appKey;

    private final String timestamp;

    private final String signature;

    private final URI uri;

    private final String signAlg;

    private final String version;

    private String parameters;

    public SignParameters(final String version,
                          final String appKey,
                          final String timestamp,
                          final String signature,
                          final URI uri) {
        this(version, appKey, timestamp, signature, uri, SignUtils.SIGN_MD5);
    }

    public SignParameters(final String version,
                          final String appKey,
                          final String timestamp,
                          final String signature,
                          final URI uri,
                          final String signAlg) {
        this.version = version;
        this.appKey = appKey;
        this.timestamp = timestamp;
        this.signature = signature;
        this.uri = uri;
        this.signAlg = signAlg;
    }

    public SignParameters() {
        this(null, null, null, null, null);
    }

    public String getAppKey() {
        return appKey;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public String getSignature() {
        return signature;
    }

    public URI getUri() {
        return uri;
    }

    public String getSignAlg() {
        return signAlg;
    }

    public String getVersion() {
        return version;
    }

    public String getParameters() {
        return parameters;
    }

    public void setParameters(String parameters) {
        this.parameters = parameters;
    }

    @Override
    public String toString() {
        return "SignParameters{" +
                "appKey='" + appKey + '\'' +
                ", timestamp='" + timestamp + '\'' +
                ", signature='" + signature + '\'' +
                ", uri=" + uri +
                ", signAlg='" + signAlg + '\'' +
                ", version='" + version + '\'' +
                ", parameters='" + parameters + '\'' +
                '}';
    }
}
